#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    string modifyString(string s) {
        for (int i = 0; i < s.size(); i++)
        {
            if (s[i] == '?')
            {
                char ch = 'a';
                if (i == 0)
                {
                    while (ch == s[i + 1])
                        ch++;
                }
                else if (i == s.size() - 1)
                {
                    while (ch == s[i - 1])
                        ch++;
                }
                else
                {
                    while (ch == s[i - 1] || ch == s[i + 1])
                    {
                        ch++;
                    }
                }
                s[i] = ch;
            }
        }
        return s;
    }
};